#include "string.h"
#include "std_Types.h"
#include "NvM.h"
#include "NvM_SWC_WriteBlock.h"
#include "NvM_SWC_Did.h"

Std_ReturnType Dcm_WriteBlock(NvM_BlockIdType BlockId,uint8 *ErrorCode)
{
    Std_ReturnType Ret;
    uint8 NvM_Manager_Sts = NvM_Get_DID_Write_Sts(BlockId);

    if(Store_Idle == NvM_Manager_Sts)
    {
        NvM_Req_Write(BlockId);
        Ret = DCM_E_PENDING;
    }
    else if((Store_Pending == NvM_Manager_Sts) || (Store_Request == NvM_Manager_Sts))
    {
        /* return 0x78 when NvM_Write_Block_MainFunction invoke in NVM_SWC task */
        Ret = DCM_E_PENDING;
    }
    else if(Store_OK == NvM_Manager_Sts)
    {
        Ret = E_OK;
    }
    else/* if(Store_Error == NvM_Manager_Sts)*/
    {
        *ErrorCode = DCM_E_GENERALPROGRAMMINGFAILURE;
        Ret = E_NOT_OK;
    }


    return Ret;
}

FUNC(Std_ReturnType,DCM_APPL_CODE) DcmDspDataReadFnc_0xF187 (P2VAR(uint8,AUTOMATIC,DCM_INTERN_DATA) Data)
{
   memcpy(Data,Flash_Did_data.Flash_DID_F187,Flash_DID_F187_Size);
   return E_OK;
}

FUNC(Std_ReturnType,DCM_APPL_CODE) DcmDspDataReadFnc_0xF189 (P2VAR(uint8,AUTOMATIC,DCM_INTERN_DATA) Data)
{
   memcpy(Data,Flash_Did_data.Flash_DID_F189,Flash_DID_F189_Size);
   return E_OK;
}

FUNC(Std_ReturnType,DCM_APPL_CODE) DcmDspDataReadFnc_0xF18A (P2VAR(uint8,AUTOMATIC,DCM_INTERN_DATA) Data)
{
   memcpy(Data,Flash_Did_data.Flash_DID_F18A,Flash_DID_F18A_Size);
   return E_OK;
}

FUNC(Std_ReturnType,DCM_APPL_CODE) DcmDspDataReadFnc_0xF18B (P2VAR(uint8,AUTOMATIC,DCM_INTERN_DATA) Data)
{
   memcpy(Data,NvM_DID_F18B,NVM_CFG_NV_BLOCK_LENGTH_NvMBlockDescriptor_F18B);
   return E_OK;
}
FUNC(Std_ReturnType,DCM_APPL_CODE) DcmDspDataReadFnc_0xF18C (P2VAR(uint8,AUTOMATIC,DCM_INTERN_DATA) Data)
{
   memcpy(Data,NvM_DID_F18C,NVM_CFG_NV_BLOCK_LENGTH_NvMBlockDescriptor_F18C);
   return E_OK;
}
FUNC(Std_ReturnType,DCM_APPL_CODE) DcmDspDataWriteFnc_0xF190 (P2CONST(uint8,AUTOMATIC,DCM_INTERN_DATA) Data,P2VAR(Dcm_NegativeResponseCodeType,AUTOMATIC,DCM_INTERN_DATA) ErrorCode)
{
   Std_ReturnType Ret;
   (void)ErrorCode;
   memcpy(NvM_DID_F190,Data,NVM_CFG_NV_BLOCK_LENGTH_NvMBlockDescriptor_F190);
   Ret = Dcm_WriteBlock(NvMConf_NvMBlockDescriptor_NvMBlockDescriptor_F190,ErrorCode);
   return Ret;
}

FUNC(Std_ReturnType,DCM_APPL_CODE) DcmDspDataReadFnc_0xF190 (P2VAR(uint8,AUTOMATIC,DCM_INTERN_DATA) Data)
{
   memcpy(Data,NvM_DID_F190,NVM_CFG_NV_BLOCK_LENGTH_NvMBlockDescriptor_F190);
   return E_OK;
}
FUNC(Std_ReturnType,DCM_APPL_CODE) DcmDspDataReadFnc_0xF191 (P2VAR(uint8,AUTOMATIC,DCM_INTERN_DATA) Data)
{
   memcpy(Data,Flash_Did_data.Flash_DID_F191,Flash_DID_F191_Size);
   return E_OK;
}

FUNC(Std_ReturnType,DCM_APPL_CODE) DcmDspDataReadFnc_0xF193 (P2VAR(uint8,AUTOMATIC,DCM_INTERN_DATA) Data)
{
   memcpy(Data,Flash_Did_data.Flash_DID_F193,Flash_DID_F193_Size);
   return E_OK;
}

FUNC(Std_ReturnType,DCM_APPL_CODE) DcmDspDataReadFnc_0xF195 (P2VAR(uint8,AUTOMATIC,DCM_INTERN_DATA) Data)
{
   memcpy(Data,Flash_Did_data.Flash_DID_F195,Flash_DID_F195_Size);
   return E_OK;
}

FUNC(Std_ReturnType,DCM_APPL_CODE) DcmDspDataReadFnc_0xF197 (P2VAR(uint8,AUTOMATIC,DCM_INTERN_DATA) Data)
{
   memcpy(Data,Flash_Did_data.Flash_DID_F197,Flash_DID_F197_Size);
   return E_OK;
}

FUNC(Std_ReturnType,DCM_APPL_CODE) DcmDspDataWriteFnc_0xF199 (P2CONST(uint8,AUTOMATIC,DCM_INTERN_DATA) Data,P2VAR(Dcm_NegativeResponseCodeType,AUTOMATIC,DCM_INTERN_DATA) ErrorCode)
{
   Std_ReturnType Ret;
   (void)ErrorCode;
   memcpy(NvM_DID_F199,Data,NVM_CFG_NV_BLOCK_LENGTH_NvMBlockDescriptor_F199);
   Ret = Dcm_WriteBlock(NvMConf_NvMBlockDescriptor_NvMBlockDescriptor_F199,ErrorCode);
   return Ret;
}

FUNC(Std_ReturnType,DCM_APPL_CODE) DcmDspDataReadFnc_0xF199 (P2VAR(uint8,AUTOMATIC,DCM_INTERN_DATA) Data)
{
   memcpy(Data,NvM_DID_F199,NVM_CFG_NV_BLOCK_LENGTH_NvMBlockDescriptor_F199);
   return E_OK;
}
FUNC(Std_ReturnType,DCM_APPL_CODE) DcmDspDataWriteFnc_0xF19D (P2CONST(uint8,AUTOMATIC,DCM_INTERN_DATA) Data,P2VAR(Dcm_NegativeResponseCodeType,AUTOMATIC,DCM_INTERN_DATA) ErrorCode)
{
   Std_ReturnType Ret;
   (void)ErrorCode;
   memcpy(NvM_DID_F19D,Data,NVM_CFG_NV_BLOCK_LENGTH_NvMBlockDescriptor_F19D);
   Ret = Dcm_WriteBlock(NvMConf_NvMBlockDescriptor_NvMBlockDescriptor_F19D,ErrorCode);
   return Ret;
}

FUNC(Std_ReturnType,DCM_APPL_CODE) DcmDspDataReadFnc_0xF19D (P2VAR(uint8,AUTOMATIC,DCM_INTERN_DATA) Data)
{
   memcpy(Data,NvM_DID_F19D,NVM_CFG_NV_BLOCK_LENGTH_NvMBlockDescriptor_F19D);
   return E_OK;
}
FUNC(Std_ReturnType,DCM_APPL_CODE) DcmDspDataReadFnc_0x2101 (P2VAR(uint8,AUTOMATIC,DCM_INTERN_DATA) Data)
{
   memcpy(Data,Ram_DID_2101,Ram_DID_2101_Size);
   return E_OK;
}

FUNC(Std_ReturnType,DCM_APPL_CODE) DcmDspDataWriteFnc_0x2102 (P2CONST(uint8,AUTOMATIC,DCM_INTERN_DATA) Data,P2VAR(Dcm_NegativeResponseCodeType,AUTOMATIC,DCM_INTERN_DATA) ErrorCode)
{
   Std_ReturnType Ret;
   (void)ErrorCode;
   memcpy(NvM_DID_2102,Data,NVM_CFG_NV_BLOCK_LENGTH_NvMBlockDescriptor_2102);
   Ret = Dcm_WriteBlock(NvMConf_NvMBlockDescriptor_NvMBlockDescriptor_2102,ErrorCode);
   return Ret;
}

FUNC(Std_ReturnType,DCM_APPL_CODE) DcmDspDataReadFnc_0x2102 (P2VAR(uint8,AUTOMATIC,DCM_INTERN_DATA) Data)
{
   memcpy(Data,NvM_DID_2102,NVM_CFG_NV_BLOCK_LENGTH_NvMBlockDescriptor_2102);
   return E_OK;
}
FUNC(Std_ReturnType,DCM_APPL_CODE) DcmDspDataWriteFnc_0x2103 (P2CONST(uint8,AUTOMATIC,DCM_INTERN_DATA) Data,P2VAR(Dcm_NegativeResponseCodeType,AUTOMATIC,DCM_INTERN_DATA) ErrorCode)
{
   Std_ReturnType Ret;
   (void)ErrorCode;
   memcpy(NvM_DID_2103,Data,NVM_CFG_NV_BLOCK_LENGTH_NvMBlockDescriptor_2103);
   Ret = Dcm_WriteBlock(NvMConf_NvMBlockDescriptor_NvMBlockDescriptor_2103,ErrorCode);
   return Ret;
}

FUNC(Std_ReturnType,DCM_APPL_CODE) DcmDspDataReadFnc_0x2103 (P2VAR(uint8,AUTOMATIC,DCM_INTERN_DATA) Data)
{
   memcpy(Data,NvM_DID_2103,NVM_CFG_NV_BLOCK_LENGTH_NvMBlockDescriptor_2103);
   return E_OK;
}
FUNC(Std_ReturnType,DCM_APPL_CODE) DcmDspDataReadFnc_0x2104 (P2VAR(uint8,AUTOMATIC,DCM_INTERN_DATA) Data)
{
   memcpy(Data,NvM_DID_2104,NVM_CFG_NV_BLOCK_LENGTH_NvMBlockDescriptor_2104);
   return E_OK;
}
FUNC(Std_ReturnType,DCM_APPL_CODE) DcmDspDataReadFnc_0x2105 (P2VAR(uint8,AUTOMATIC,DCM_INTERN_DATA) Data)
{
   memcpy(Data,Flash_Did_data.Flash_DID_2105,Flash_DID_2105_Size);
   return E_OK;
}

FUNC(Std_ReturnType,DCM_APPL_CODE) DcmDspDataWriteFnc_0x2106 (P2CONST(uint8,AUTOMATIC,DCM_INTERN_DATA) Data,P2VAR(Dcm_NegativeResponseCodeType,AUTOMATIC,DCM_INTERN_DATA) ErrorCode)
{
   Std_ReturnType Ret;
   (void)ErrorCode;
   memcpy(NvM_DID_2106,Data,NVM_CFG_NV_BLOCK_LENGTH_NvMBlockDescriptor_2106);
   Ret = Dcm_WriteBlock(NvMConf_NvMBlockDescriptor_NvMBlockDescriptor_2106,ErrorCode);
   return Ret;
}

FUNC(Std_ReturnType,DCM_APPL_CODE) DcmDspDataReadFnc_0x2106 (P2VAR(uint8,AUTOMATIC,DCM_INTERN_DATA) Data)
{
   memcpy(Data,NvM_DID_2106,NVM_CFG_NV_BLOCK_LENGTH_NvMBlockDescriptor_2106);
   return E_OK;
}
FUNC(Std_ReturnType,DCM_APPL_CODE) DcmDspDataWriteFnc_0x2107 (P2CONST(uint8,AUTOMATIC,DCM_INTERN_DATA) Data,P2VAR(Dcm_NegativeResponseCodeType,AUTOMATIC,DCM_INTERN_DATA) ErrorCode)
{
   Std_ReturnType Ret;
   (void)ErrorCode;
   memcpy(NvM_DID_2107,Data,NVM_CFG_NV_BLOCK_LENGTH_NvMBlockDescriptor_2107);
   Ret = Dcm_WriteBlock(NvMConf_NvMBlockDescriptor_NvMBlockDescriptor_2107,ErrorCode);
   return Ret;
}

FUNC(Std_ReturnType,DCM_APPL_CODE) DcmDspDataReadFnc_0x2107 (P2VAR(uint8,AUTOMATIC,DCM_INTERN_DATA) Data)
{
   memcpy(Data,NvM_DID_2107,NVM_CFG_NV_BLOCK_LENGTH_NvMBlockDescriptor_2107);
   return E_OK;
}
FUNC(Std_ReturnType,DCM_APPL_CODE) DcmDspDataWriteFnc_0x2109 (P2CONST(uint8,AUTOMATIC,DCM_INTERN_DATA) Data,P2VAR(Dcm_NegativeResponseCodeType,AUTOMATIC,DCM_INTERN_DATA) ErrorCode)
{
   Std_ReturnType Ret;
   (void)ErrorCode;
   memcpy(NvM_DID_2109,Data,NVM_CFG_NV_BLOCK_LENGTH_NvMBlockDescriptor_2109);
   Ret = Dcm_WriteBlock(NvMConf_NvMBlockDescriptor_NvMBlockDescriptor_2109,ErrorCode);
   return Ret;
}

FUNC(Std_ReturnType,DCM_APPL_CODE) DcmDspDataReadFnc_0x2109 (P2VAR(uint8,AUTOMATIC,DCM_INTERN_DATA) Data)
{
   memcpy(Data,NvM_DID_2109,NVM_CFG_NV_BLOCK_LENGTH_NvMBlockDescriptor_2109);
   return E_OK;
}
FUNC(Std_ReturnType,DCM_APPL_CODE) DcmDspDataWriteFnc_0x2110 (P2CONST(uint8,AUTOMATIC,DCM_INTERN_DATA) Data,P2VAR(Dcm_NegativeResponseCodeType,AUTOMATIC,DCM_INTERN_DATA) ErrorCode)
{
   Std_ReturnType Ret;
   (void)ErrorCode;
   memcpy(NvM_DID_2110,Data,NVM_CFG_NV_BLOCK_LENGTH_NvMBlockDescriptor_2110);
   Ret = Dcm_WriteBlock(NvMConf_NvMBlockDescriptor_NvMBlockDescriptor_2110,ErrorCode);
   return Ret;
}

FUNC(Std_ReturnType,DCM_APPL_CODE) DcmDspDataReadFnc_0x2110 (P2VAR(uint8,AUTOMATIC,DCM_INTERN_DATA) Data)
{
   memcpy(Data,NvM_DID_2110,NVM_CFG_NV_BLOCK_LENGTH_NvMBlockDescriptor_2110);
   return E_OK;
}
FUNC(Std_ReturnType,DCM_APPL_CODE) DcmDspDataWriteFnc_0x2111 (P2CONST(uint8,AUTOMATIC,DCM_INTERN_DATA) Data,P2VAR(Dcm_NegativeResponseCodeType,AUTOMATIC,DCM_INTERN_DATA) ErrorCode)
{
   Std_ReturnType Ret;
   (void)ErrorCode;
   memcpy(NvM_DID_2111,Data,NVM_CFG_NV_BLOCK_LENGTH_NvMBlockDescriptor_2111);
   Ret = Dcm_WriteBlock(NvMConf_NvMBlockDescriptor_NvMBlockDescriptor_2111,ErrorCode);
   return Ret;
}

FUNC(Std_ReturnType,DCM_APPL_CODE) DcmDspDataReadFnc_0x2111 (P2VAR(uint8,AUTOMATIC,DCM_INTERN_DATA) Data)
{
   memcpy(Data,NvM_DID_2111,NVM_CFG_NV_BLOCK_LENGTH_NvMBlockDescriptor_2111);
   return E_OK;
}
FUNC(Std_ReturnType,DCM_APPL_CODE) DcmDspDataWriteFnc_0xF1A0 (P2CONST(uint8,AUTOMATIC,DCM_INTERN_DATA) Data,P2VAR(Dcm_NegativeResponseCodeType,AUTOMATIC,DCM_INTERN_DATA) ErrorCode)
{
   Std_ReturnType Ret;
   (void)ErrorCode;
   memcpy(NvM_DID_F1A0,Data,NVM_CFG_NV_BLOCK_LENGTH_NvMBlockDescriptor_F1A0);
   Ret = Dcm_WriteBlock(NvMConf_NvMBlockDescriptor_NvMBlockDescriptor_F1A0,ErrorCode);
   return Ret;
}

FUNC(Std_ReturnType,DCM_APPL_CODE) DcmDspDataReadFnc_0xF1A0 (P2VAR(uint8,AUTOMATIC,DCM_INTERN_DATA) Data)
{
   memcpy(Data,NvM_DID_F1A0,NVM_CFG_NV_BLOCK_LENGTH_NvMBlockDescriptor_F1A0);
   return E_OK;
}
FUNC(Std_ReturnType,DCM_APPL_CODE) DcmDspDataReadFnc_0xF100 (P2VAR(uint8,AUTOMATIC,DCM_INTERN_DATA) Data)
{
   memcpy(Data,NvM_DID_F100,NVM_CFG_NV_BLOCK_LENGTH_NvMBlockDescriptor_F100);
   return E_OK;
}
FUNC(Std_ReturnType,DCM_APPL_CODE) DcmDspDataWriteFnc_0xF1A1 (P2CONST(uint8,AUTOMATIC,DCM_INTERN_DATA) Data,P2VAR(Dcm_NegativeResponseCodeType,AUTOMATIC,DCM_INTERN_DATA) ErrorCode)
{
   Std_ReturnType Ret;
   (void)ErrorCode;
   memcpy(NvM_DID_F1A1,Data,NVM_CFG_NV_BLOCK_LENGTH_NvMBlockDescriptor_F1A1);
   Ret = Dcm_WriteBlock(NvMConf_NvMBlockDescriptor_NvMBlockDescriptor_F1A1,ErrorCode);
   return Ret;
}

FUNC(Std_ReturnType,DCM_APPL_CODE) DcmDspDataReadFnc_0xF1A1 (P2VAR(uint8,AUTOMATIC,DCM_INTERN_DATA) Data)
{
   memcpy(Data,NvM_DID_F1A1,NVM_CFG_NV_BLOCK_LENGTH_NvMBlockDescriptor_F1A1);
   return E_OK;
}
FUNC(Std_ReturnType,DCM_APPL_CODE) DcmDspDataReadFnc_0xF180 (P2VAR(uint8,AUTOMATIC,DCM_INTERN_DATA) Data)
{
   memcpy(Data,Flash_Did_data.Flash_DID_F180,Flash_DID_F180_Size);
   return E_OK;
}

FUNC(Std_ReturnType,DCM_APPL_CODE) DcmDspDataReadFnc_0xF17D (P2VAR(uint8,AUTOMATIC,DCM_INTERN_DATA) Data)
{
   memcpy(Data,Flash_Did_data.Flash_DID_F17D,Flash_DID_F17D_Size);
   return E_OK;
}

FUNC(Std_ReturnType,DCM_APPL_CODE) DcmDspDataReadFnc_0xF17E (P2VAR(uint8,AUTOMATIC,DCM_INTERN_DATA) Data)
{
   memcpy(Data,Flash_Did_data.Flash_DID_F17E,Flash_DID_F17E_Size);
   return E_OK;
}

FUNC(Std_ReturnType,DCM_APPL_CODE) DcmDspDataReadFnc_0xF17F (P2VAR(uint8,AUTOMATIC,DCM_INTERN_DATA) Data)
{
   memcpy(Data,Flash_Did_data.Flash_DID_F17F,Flash_DID_F17F_Size);
   return E_OK;
}

FUNC(Std_ReturnType,DCM_APPL_CODE) DcmDspDataReadFnc_0xF181 (P2VAR(uint8,AUTOMATIC,DCM_INTERN_DATA) Data)
{
   memcpy(Data,Flash_Did_data.Flash_DID_F181,Flash_DID_F181_Size);
   return E_OK;
}

FUNC(Std_ReturnType,DCM_APPL_CODE) DcmDspDataReadFnc_0x21F0 (P2VAR(uint8,AUTOMATIC,DCM_INTERN_DATA) Data)
{
   memcpy(Data,NvM_DID_21F0,NVM_CFG_NV_BLOCK_LENGTH_NvMBlockDescriptor_21F0);
   return E_OK;
}
FUNC(Std_ReturnType,DCM_APPL_CODE) DcmDspDataReadFnc_0x21F1 (P2VAR(uint8,AUTOMATIC,DCM_INTERN_DATA) Data)
{
   memcpy(Data,NvM_DID_21F1,NVM_CFG_NV_BLOCK_LENGTH_NvMBlockDescriptor_21F1);
   return E_OK;
}
FUNC(Std_ReturnType,DCM_APPL_CODE) DcmDspDataReadFnc_0x21A0 (P2VAR(uint8,AUTOMATIC,DCM_INTERN_DATA) Data)
{
   memcpy(Data,Ram_DID_21A0,Ram_DID_21A0_Size);
   return E_OK;
}

FUNC(Std_ReturnType,DCM_APPL_CODE) DcmDspDataReadFnc_0x21A1 (P2VAR(uint8,AUTOMATIC,DCM_INTERN_DATA) Data)
{
   memcpy(Data,Ram_DID_21A1,Ram_DID_21A1_Size);
   return E_OK;
}

FUNC(Std_ReturnType,DCM_APPL_CODE) DcmDspDataReadFnc_0x21A2 (P2VAR(uint8,AUTOMATIC,DCM_INTERN_DATA) Data)
{
   memcpy(Data,Ram_DID_21A2,Ram_DID_21A2_Size);
   return E_OK;
}

FUNC(Std_ReturnType,DCM_APPL_CODE) DcmDspDataReadFnc_0x21A3 (P2VAR(uint8,AUTOMATIC,DCM_INTERN_DATA) Data)
{
   memcpy(Data,Ram_DID_21A3,Ram_DID_21A3_Size);
   return E_OK;
}

FUNC(Std_ReturnType,DCM_APPL_CODE) DcmDspDataReadFnc_0x21A4 (P2VAR(uint8,AUTOMATIC,DCM_INTERN_DATA) Data)
{
   memcpy(Data,Ram_DID_21A4,Ram_DID_21A4_Size);
   return E_OK;
}

